import { createSlice } from "@reduxjs/toolkit";

const countStore = createSlice({
    name: 'count',
    initialState: {
        rcount: 0
    },
    reducers: {
        increment: (state) => {
            state.rcount += 1
        },
        decrement: (state) => {
            state.rcount -= 1
        },
        addToNum:(state,action) => {
            state.rcount = action.payload
        }
    }
})

export const { increment, decrement, addToNum } = countStore.actions;


export default countStore.reducer